package com.lr.server.xml;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;

public class ParseDemo1 {

	public static void main(String[] args) throws IOException {
        //获取解析工厂
		SAXParserFactory factory = SAXParserFactory.newInstance();
		//从解析工厂获取解析器
		try {
			SAXParser parse = factory.newSAXParser();
			//加载文档  注册处理器
			parse.parse(Thread.currentThread().getContextClassLoader().getResourceAsStream("com/lr/server/xml/person.xml"),
					new PersonHandler());
			
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		}
	}

}
